package org.zachary.creditbusiness.commodityandhouse.service.impl;

import org.zachary.creditbusiness.commodityandhouse.entity.HouseDetails;
import org.zachary.creditbusiness.commodityandhouse.mapper.HouseDetailsMapper;
import org.zachary.creditbusiness.commodityandhouse.service.HouseDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class HouseDetailsServiceImpl implements HouseDetailsService {

    @Autowired
    private HouseDetailsMapper houseDetailsMapper;

    @Override
    public HouseDetails getHouseDetailsById(Integer id) {
        return houseDetailsMapper.selectById(id);
    }

    @Override
    public List<HouseDetails> getAllHouseDetails() {
        return houseDetailsMapper.selectList(null);
    }

    @Override
    public HouseDetails createHouseDetails(HouseDetails houseDetails) {
        houseDetailsMapper.insert(houseDetails);
        return houseDetails;
    }

    @Override
    public HouseDetails updateHouseDetails(HouseDetails houseDetails) {
        houseDetailsMapper.updateById(houseDetails);
        return houseDetails;
    }

    @Override
    public void deleteHouseDetails(Integer id) {
        houseDetailsMapper.deleteById(id);
    }
}
